home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
- sort(1)
-
-
-
- NAME
- sort - sort and/or merge files
-
- SYNTAX
- sort [ -bdfimnrutx ] [ +pos1 [ -pos2 ] ] [ -o name ] [ -T dir ] [ name...]
-
- DESCRIPTION
- Sort sorts, then writes the lines of the named files to its standard
- output, or a file (-o option).
- Default (no input files are named), the standard input is sorted.
- The name "-" stands for the standard input, so that standard input can be
- used together with other input files.
-
- By default, the sort key is an entire line; ordering is lexicographic.
- The global ordering is affected by zero or more of the following options
- (of which some combinations are meaningless, e.g. d and n).
-
- -b Leading blanks (spaces and tabs) are skipped in field comparisons.
-
- -d Dictionary order: only letters, digits and blanks are
- significant in comparisons.
-
- -f Fold: treat upper case as if lower case.
-
- -i Ignore characters outside the ASCII range 040-0176 in
- nonnumeric comparisons.
-
- -n An initial numeric string, consisting of optional
- blanks, optional minus sign, and zero or more digits
- with optional decimal point, is sorted by arithmetic
- value. This option implies option b.
-
- -r Reverse the result of comparisons.
-
- -tx `Tab character' field separator is x.
-
- The notation +pos1 -pos2 restricts a sort key to a field
- beginning at pos1 and ending just before pos2.
- Pos1 and pos2 each have the form m.n, optionally followed by one
- or more of the options bdfinr, where m tells a number of fields
- to skip from the beginning of the line and n tells a number
- of characters to skip further. If any options are present
- they override all the global ordering options for this key.
- If the b option is in effect n is counted from the first
- nonblank in the field.
- A missing .n means .0; a missing -pos2 means the end of the
- line. Under the -tx option, fields are strings separated by
- x; otherwise fields are nonempty nonblank strings separated
- by blanks.
-
- When there are multiple sort keys, later keys are compared
- only after all earlier keys compare equal.
-
- These are additional (global) options:
-
- -c Check that the input file is sorted according to the key(s);
- if the file is out of sort, an error message is printed.
- Exit code is 0/1 for correctly/incorrectly sorted input.
-
- -m Merge only, the input files are already sorted.
-
- -o The next argument is the output file used instead of the
- standard output. This file may be the same as one of the inputs.
-
- -T Temporary files directory. Default is \tmp on the current drive.
-
- -u Unique: Select only one in each set of, according to the
- key(s), equal lines.
-
- RESTRICTIONS
- Very long (>256 chars) lines are silently truncated.
- The line terminator sequence \r\n is present in the line when
- doing comparisions; this should not present problems. Use of \0 in
- input is discouraged, since this will be seen as a C string terminator.
-
- DIAGNOSTICS
- Comments and exits with nonzero status for various trouble
- conditions and for disorder discovered under option c(heck).
-
- FILES
- \tmp\* for temporary files.
-
-